
  <link href="{$data.theme}/libs/css/select/select2.min.css" rel="stylesheet">


    <div class="row">
    <div class="col-md-12 col-sm-12 col-xs-12">
        <div class="x_panel">
            <div class="x_title">
                <h2>管理员添加</h2>

                <div class="clearfix"></div>
            </div>
            <div class="x_content">
                <div class="" role="tabpanel" data-example-id="togglable-tabs">
                    <div id="myTabContent" class="tab-content">
                        <div role="tabpanel" class="tab-pane fade active in" id="tab_content1"  aria-labelledby="home-tab">
                            <div class="row">
                                <div class="col-md-6 col-sm-8 col-xl-12">

                                    <form action="/admin/add.html" method="post" class="form-horizontal form-label-left">
                                        <div class="form-group">
                                            <label class="control-label col-md-3 col-sm-3 col-xs-3">*管理员名称</label>

                                            <div class="col-md-6 col-sm-6 col-xs-6">
                                                <input type="text" class="form-control" value="" name="admin_name" placeholder="">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="control-label col-md-3 col-sm-3 col-xs-3">*管理员姓名</label>

                                            <div class="col-md-6 col-sm-6 col-xs-6">
                                                <input type="text" class="form-control" value="" name="sex_name" placeholder="">
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label class="control-label col-md-3 col-sm-3 col-xs-3">*管理员账号</label>

                                            <div class="col-md-6 col-sm-6 col-xs-6">
                                                <input type="text" class="form-control" value="" name="username" placeholder="">
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label class="control-label col-md-3 col-sm-3 col-xs-3">密码</label>

                                            <div class="col-md-6 col-sm-6 col-xs-6">
                                                <input type="password" class="form-control" value="" name="password" placeholder="">
                                                <span class="help-block">请填写大于6位英文字符作为密码</span>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label class="control-label col-md-3 col-sm-3 col-xs-3">确认密码</label>

                                            <div class="col-md-6 col-sm-6 col-xs-6">
                                                <input type="password" class="form-control" value="" name="checkpassword" placeholder="">
                                            </div>
                                        </div>

                                        <div class="form-group">
                                          <label class="control-label col-md-3 col-sm-3 col-xs-12">*角色</label>
                                          <div class="col-md-9 col-sm-9 col-xs-12">
                                            <select name="role[]" class="form-control">
                                              {foreach $data.role $val $key}
                                              <option value="{$val['id']}" >{$val['name']}</option>
                                              {/foreach}
                                            </select>
                                          </div>
                                        </div>

                                        <div class="form-group">
                                            <label class="control-label col-md-3 col-sm-3 col-xs-3">*状态</label>
                                            <div class="col-md-3 col-sm-3 col-xs-3">
                                                <select class="form-control" name="status">
                                                    <option value="1" >启用</option>
                                                    <option value="0" >禁用</option>
                                                </select>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label class="control-label col-md-3 col-sm-3 col-xs-3">*短信验证码</label>
                                            <div class="col-md-6 col-sm-6 col-xs-6">
                                                <input type="text" class="form-control" value="" name="code" placeholder="">
                                                <input id="btn" class="btn btn-primary" type="button" value="获取验证码" onclick="sendemail()" />
                                            </div>
                                        </div>

                                        <div class="ln_solid"></div>
                                        <div class="form-group">
                                            <div class="col-md-9 col-sm-9 col-xs-12 col-md-offset-3">
                                                <input type="hidden" name="id" value="">
                                                <button type="submit" class="btn btn-primary">保存</button>
                                                <a href="javascript:history.back();" class="btn">取消</a>
                                            </div>
                                        </div>
                                    </form>
                                    <div class="dataTables_paginate paging_simple_numbers">
                                        <div class="btn-toolbar">
                                            <div class="btn-group">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="{$data.theme}/js/source/layer/layer.js"></script>
    <script src="{$data.theme}/libs/js/select/select2.full.js"></script>

  <script>
   /*$(function () {

      $(".select2_multiple").select2({
        maximumSelectionLength: 3,
        placeholder: "选择角色、可选多个、最多三个",
        allowClear: true
      });
    });*/

   var countdown=60;
   function sendemail(){
       var obj = $("#btn");
       settime(obj);
       var url = "{['admin/sendsms']|U}";
       $.get(url);
   }
   function settime(obj) { //发送验证码倒计时
       if (countdown == 0) {
           obj.attr('disabled',false);
           //obj.removeattr("disabled");
           obj.val("获取验证码");
           countdown = 60;
           return;
       } else {
           obj.attr('disabled',true);
           obj.val("重新发送(" + countdown + ")");
           countdown--;
       }
       setTimeout(function() {
               settime(obj) }
           ,1000)
   }
  </script>
</div>
